<?php
	class Login_model extends CI_Model
	{
		public function __construct()
		{
			parent::__construct();
		}
		public function query()
		{
			$this->db->where("Username",$this->input->post("username"));
			$this->db->where("Password",$this->input->post("password"));
			$this->query = $this->db->get("accounts");
			if($this->query->num_rows() > 0)
			{
				return true;
			}
		}
		public function admin_model()
		{
			$q = $this->db->get("accounts");
			foreach($q->result() as $row)
			{
				$data[] = $row;
			}
			return $data;
		}
		public function delete_row()
		{
			$this->db->where("AcccountId",$this->uri->segment(3));
			$this->db->delete("accounts");
		}
		public function update_row()
		{
			$data = array(
				"UserName" => $this->input->post("username"),
				"Password" => $this->input->post("password"),
				"FullName" => $this->input->post("full_name"),
				"DateOfBirth" => $this->input->post("date_of_birth"),
				"Sex" => $this->input->post("sex"),
				"Email" => $this->input->post("email"),
				"IsAdmin" => $this->input->post("is_admin"),
				"Status" => $this->input->post("status"),
				"CreatedDate" => $this->input->post("create_date"),
				"CreatedBy" => $this->input->post("create_by"),
				"IsLogin" => $this->input->post("is_login"),
				"LastAccess" => $this->input->post("last_access"),
				"LoginFalse" => $this->input->post("login_false"),
			);
			$this->db->where("AcccountId",$this->uri->segment(3));
			$this->db->update("accounts",$data);
		}
	}
?>